package com.wiscamp.ninechapters.problems.infrastructure.converters;

import com.wiscamp.ninechapters.problems.domain.models.sets.KnowledgePointRule;
import com.wiscamp.ninechapters.problems.domain.models.sets.ProblemTypeRule;
import com.wiscamp.ninechapters.problems.domain.models.sets.RegroupRule;
import com.wiscamp.ninechapters.problems.domain.models.sets.TagRule;
import com.wiscamp.ninechapters.problems.infrastructure.po.sets.*;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface RegroupRuleConverter {
    RegroupRuleConverter Instance = Mappers.getMapper(RegroupRuleConverter.class);
    // region regroup rule
    RegroupRulePO toRegroupRulePO(RegroupRule entity);

    RegroupRulePO toRegroupRulePO(RegroupRule entity, @MappingTarget RegroupRulePO po);

    RegroupRule toRegroupRule(RegroupRulePO po);

    RegroupRule toRegroupRuleByView(RegroupRuleView view);
    // endregion

    // region tag rule
    TagRulePO toTagRulePO(TagRule entity);

    TagRulePO toTagRulePO(TagRule entity, @MappingTarget TagRulePO po);

    TagRule toTagRule(TagRulePO po);
    // endregion

    // region knowledge point rule
    KnowledgePointRulePO toKnowledgePointRulePO(KnowledgePointRule entity);

    KnowledgePointRulePO toKnowledgePointRulePO(KnowledgePointRule entity, @MappingTarget KnowledgePointRulePO po);

    KnowledgePointRule toKnowledgePointRule(KnowledgePointRulePO po);
    // endregion


    // region problem type rule
    ProblemTypeRulePO toProblemTypeRulePO(ProblemTypeRule entity);

    ProblemTypeRulePO toProblemTypeRulePO(ProblemTypeRule entity, @MappingTarget ProblemTypeRulePO po);

    ProblemTypeRule toProblemTypeRule(ProblemTypeRulePO po);
    // endregion
}
